<div class="page-header">
    <h1>
        Info Reward
        <small>
            <i class="icon-double-angle-right"></i>
            Info Reward Member
        </small>
    </h1>
</div>

<div class="row">
    <div class="col-xs-11">
        <!-- PAGE CONTENT BEGINS -->
        
        <div class="widget-box transparent">
        <table cellpadding="5px">

                    <tr>
                        <td>Nomor Akun</td>
                        <td>: </td>
                        <td><?php echo $this->dataAccount['account_num'];?>
                            <input type="hidden" name="accNum" id="accNum" value="<?php echo $this->dataAccount['account_num'];?>"></td>
                    </tr>
                    <tr>
                        <td>Nama Akun</td>
                        <td>: </td>
                        <td><?php echo $this->dataAccount['account_name'];?></td>
                    </tr>
                    <tr>
                        <td>Jumlah Mitra</td>
                        <td>: </td>
                        <td><?php echo number_format($this->numMitra);?></td>
                    </tr>
            </table>

        

        <table id="grid-table"></table>

        <div id="grid-pager"></div>

        </div>
        
        <script type="text/javascript">
                var $path_base = "/";//this will be used in gritter alerts containing images
        </script>

        <!-- PAGE CONTENT ENDS -->
    </div>
</div>


<script>


    jQuery(function($) {

            jQuery('#grid-table').jqGrid({
                url:'<?php echo $this->url() ?>/../../jsondata/rewardlist',
                datatype: "json",
                height: 270,
                colNames:['Level','Mitra','Reward', 'Status Reward', 'Klaim', 'Status Withdrawal'],
                colModel:[
                    {name:'level',index:'level',  width:50},
                    {name:'mitra',index:'min_mitra',width:80,align:"left", formatter:"number"},
                    {name:'reward',index:'reward_name',width:200},
                    {name:'sttsreward',index:'status_reward',width:80},
                    {name:'klaim',index:'klaim', width:100, align:"center"},
                    {name:'sttswithdraw',index:'status_withdrawal',width:80,align:"center"}
                ],
                caption:"Daftar Reward",
                rownumbers: true,
                autowidth: true
            });

            

    });

    


    function claim(bonusRewardId, rewardId){
        //location.href = "<?php echo $this->url() ?>/../claimreward?rewardId="+rewardId;

        bootbox.confirm("Cairkan Reward ?", function(result) {
                if(result) {
                    $.ajax({
                    type: 'POST',
                    dataType: 'text',
                    url: '<?php echo $this->url() ?>/../claimreward',
                    data: {bonusRewardId: bonusRewardId, rewardId: rewardId},
                    success: function(result){
                            bootbox.dialog({
                                    message: "<span class='bigger-110'>"+result+"</span>",
                                    buttons:
                                    {
                                            "button" :
                                             {
                                                    "label" : "<i class='icon-ok'></i> Ok",
                                                    "className" : "btn-sm btn-primary",
                                                    "callback": function() {
                                                            jQuery("#grid-table").jqGrid().trigger("reloadGrid");
                                                            jQuery("#grid-table").jqGrid('setGridParam',{
                                                                url:"<?php echo $this->url() ?>/../../jsondata/rewardlist"
                                                            }).trigger("reloadGrid");
                                                    }
                                            }
                                    }
                            });

                         }
                    });
                        
                }
        });

        
    }



</script>




